پرش به مطلب اصلی

Change Password API

POST /changePassword

Description

This API endpoint allows authenticated users to change their current password by providing their old password and the new password they wish to set.

Request Body

The request utilizes GraphQL to perform the changePassword mutation.

Mutation:

mutation changePassword ($oldPassword: String!, $password: String!) {
changePassword (oldPassword: $oldPassword, password: $password)
}

Variables:

{
"oldPassword": "<Current_Password>",
"password": "<New_Password>"
}
  • oldPassword (String): The user's current password.
  • password (String): The new password that the user wishes to set for their account.

Response:

  • Success (200 OK):

    • If the password change is successful, no additional data is returned, and the user's password will be updated.
  • Error (4XX/5XX):

    • Appropriate error messages and status codes will be returned in cases of incorrect old password, weak new password, or server errors.

Note:

Ensure that the old password is correct and that the new password meets the security requirements of the platform (e.g., minimum length, complexity). The user should securely store their new password after it has been changed.